<?php
/**********************************************
* 파일명: edit.php
* 설  명: 스킨파일에 포함된 텍스트파일을 수정합니다.
* 수정가능 파일확장자 : html.css.js.xml
***********************************************/
include "lib.php";

$fn = $_GET['fn'];

if(!eregi("\.($skinfiles)",$fn))
	TT_SkinManagerErrorMsg(pluginLang::plts('파일이 존재하지 않습니다'));

if ($fn !='' && substr($fn, 0,6) == "/skin/" ){
	$content = file_get_contents(ROOT.$fn);
}else{
	TT_SkinManagerErrorMsg(pluginLang::plts('파일이 존재하지 않습니다'));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php echo pluginLang::plts('스킨매니저 :: 파일편집');?></title>
	<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $service['path'];?>/style/admin/default/plugin-config.css" />
	<style type="text/css">
		.text1
		{
			background-color: #efefef;
			margin-bottom: 10px;
			padding: 10px;
		}
		
		textarea
		{
			border: 1px solid #999;
			display: block;
			height: 405px;
			width: 100%;
		}
	</style>
	<script language="JavaScript" type="text/javascript">
		//<![CDATA[
			function js_close(){
				location.reload();
				opener.location.reload();
				//self.close();
			}
		//]]>
	</script>
</head>
<body>
	<form method="post" target="ifrm" action="<?php echo $blogURL;?>/plugin/TT_SkinManagerExec/">
		<div id="layout-head">
			<h1 class="caption"><?php echo pluginLang::plts('스킨매니저 :: 파일편집');?></h1>
		</div>
	
		<div id="layout-body">
			<div class="text1"><?php echo pluginLang::plts('현재 파일');?> : <strong><?php echo str_replace(ROOT, '', $fn);?></strong></div>
			
			<input type="hidden" name="edit_file" value="<?php echo $fn;?>" />
			<textarea name="content"><?php echo htmlspecialchars($content);?></textarea>
		</div>
		
		<div id="layout-foot" class="button-box">
			<input type="submit" class="input-button" value="<?php echo pluginLang::plts('저장하기');?>" /> <input type="button" class="input-button" value="<?php echo pluginLang::plts('창닫기');?>" onclick="self.close();" />
		</div>
	</form>
	<iframe src="about:blank" name="ifrm" width="0" height="0" style="display:none;"></iframe> 
</body>
</html>
